function model=init_params(data)

%global model;

% Random Initialization



N      = size(data.dataw1(1).w,1);
k      = data.k;
k_hat  = data.k_hat;

model.N        = N;
model.alpha_01 = 5*rand(1,k)+1;
model.sigma_01 = 1*rand(1,k);

model.alpha_02 = 5*rand(1,k_hat)+1;
model.sigma_02 = 1*rand(1,k_hat);

% model.eta=zeros(k_hat, k);
% model.eta=ones(k_hat, k);
  model.eta=rand(k_hat, k)+0.01;
  model.eta=model.eta./repmat(sum(model.eta,2),1,k);

model.r1 = data.r1;
model.r2 = data.r2;

for l=1:model.r1
    for i=1:k   
     sz=size(data.dataw1(l).w,2);
     temp = rand(1,sz);
     model.beta_1(l,i).beta = temp/sum(temp);
    end
end

for r=1:model.r2
    for j=1:k_hat        
     sz=size(data.dataw2(r).w,2);
     temp = rand(1,sz);
     model.beta_2(r,j).beta=temp/sum(temp);
    end
end


model.alpha_1 = 5*rand(N,k)+1;
model.sigma_1 = 1*rand(N,k);
model.alpha_2 = 5*rand(N,k_hat)+1;
model.sigma_2 = 1*rand(N,k_hat);
model.zeta_1  = 5*rand(1,N);
model.zeta_2  = 5*rand(1,N);


for n=1:N

    temp = rand(model.r1,k);
    temp = temp./repmat(sum(temp,2),1,k);
    model.phi_1(n,:,:)=temp;
    
    
    temp = rand(model.r2,k_hat);
    temp = temp./repmat(sum(temp,2),1,k_hat);
    model.phi_2(n,:,:)=temp;
    
end


model.MINVALUE  = 0.0000001;
model.sigmamin  = 0.001;


model.lambda = 1;

end
